#ifndef _WMI_MIREADER_H
#define _WMI_MIREADER_H

/******************************************************************************
** @file	wmi_reader.h
** @author  Nestor Felipe
**
** @date	Jul 30, 2010
**
** @desc	This class represents the final interface with the end user
**          here its define all methods for other applications.
**          			
**
******************************************************************************/

#include <string>
#include "wmi_result.h"
#include "wmi_connectionmanager.h"
#include "wmi_registrymanager.h"
#include "wmi_filedirectory.h"
#include "wmi_disk.h"
#include "wmi_constants.h"

class WMI_Reader
{
public:

#define DLLCONNECTION __declspec(dllexport)
    /**
    * Init default connection to local machine
    *
    * @param void
    *
    */
    DLLCONNECTION WMI_HResult*  initConnection();

    /**
    * Init connection with an user, password to authenticate to give hostname 
    *
    * @param user is user name to authenticate
    * @param pass is the password of the user for authenticate
    * @param host is may be a dir ip or a hostname of the computer to connect
    * @return the result of state of the operation
    */
    DLLCONNECTION WMI_HResult* initConnection(std::wstring user, std::wstring pass, std::wstring host);

    /**
    * get logical disk available for the operative system
    *
    * @param result	is a set of the WMI_Disk objects to be loaded.
    * @return the result of the state of the operation
    */
    __declspec(dllexport) WMI_HResult* getRootDirectories(WMI_Result<WMI_Disk>& result);

    /**
    * obtain the files inside the given path
    *
    * @param path is the path to list the files.
    * @param result	is a set of the WMI_FileDirectory objects to be loaded. 
    * @return the state of the operation
    * @return the result of the state of the operation
    */
    __declspec(dllexport) WMI_HResult* getFiles(std::wstring path,WMI_Result<WMI_FileDirectory> & result);

    /**
    * Gets all proccess of the host.
    *
    * @return  a set of the WMI_Process objects
    */
#define DLLPROCESS __declspec(dllexport)
    DLLPROCESS WMI_Result<WMI_Process>* getProccesses();

    /**
    * Loads all proccess of the host in a list.
    *
    * @param listProccesses 
    */
    DLLPROCESS WMI_HResult* getProccesses(WMI_Result<WMI_Process> &listProccesses);

    /**
    * Gets all files shared of the host.
    *
    * @param shares	- to return the result of the shares
    */
#define DLLSHARE __declspec(dllexport)
    DLLSHARE WMI_Result<WMI_Share>* getShares();

    /**
    * Loads all shares of the host in a list.
    *
    * @param shareList	is a reference to a set of the WMI_Share objects.
    */
    DLLSHARE WMI_HResult* getShares(WMI_Result<WMI_Share> &shareList);


    /**
    * Gets the registry root tree values
    *
    * @param standarRegistrys is a reference to a set of the WMI_Registry objects which is used
    * to be loaded all registries. 
    */
    __declspec(dllexport) void getStandardRegistryHives(WMI_Result<WMI_Registry>& standarRegistrys);

    /**
    * Gets values of the registry of the system.
    *
    * @param path is the path to list the content of the registry.
    * @param shareList is a reference to a set of the WMI_Share objects.
    */
    __declspec(dllexport) void getRegistryChildren(wstring path, WMI_Result<WMI_Registry> &registryList);

    /**
    * Close the WMI WMI_IConnection
    */
    __declspec(dllexport) int closeConnection();

public:
    /**
    * For manage registry connection
    */
    WMI_Connection registryConnection;

    /**
    * for manage other connections
    */
    WMI_Connection WMI_IConnection;	
};

#endif
